namespace GeoWeb.Demo.CodeValue
{
    using System;
    using GeoWeb.DataContext;


    /// <summary>
    /// 表名：CodeValue 主键列：
    /// </summary>
    [SerializableAttribute()]
    public partial class CodeValue : Entity
    {

        protected Guid _CodeValueOID;

        protected String _CodeID;

        protected String _CodeName;

        protected String _ParentCodeID;

        protected String _PinYinCode;

        protected String _CodeTableID;

        protected String _ClassCode;

        protected Guid? _ParentOID;

        protected Guid? _CodeClassifyOID;

        public Guid CodeValueOID
        {
            get
            {
                return this._CodeValueOID;
            }
            set
            {
                this.OnPropertyValueChange(_.CodeValueOID, _CodeValueOID, value);
                this._CodeValueOID = value;
            }
        }

        public String CodeID
        {
            get
            {
                return this._CodeID;
            }
            set
            {
                this.OnPropertyValueChange(_.CodeID, _CodeID, value);
                this._CodeID = value;
            }
        }

        public String CodeName
        {
            get
            {
                return this._CodeName;
            }
            set
            {
                this.OnPropertyValueChange(_.CodeName, _CodeName, value);
                this._CodeName = value;
            }
        }

        public String ParentCodeID
        {
            get
            {
                return this._ParentCodeID;
            }
            set
            {
                this.OnPropertyValueChange(_.ParentCodeID, _ParentCodeID, value);
                this._ParentCodeID = value;
            }
        }

        public String PinYinCode
        {
            get
            {
                return this._PinYinCode;
            }
            set
            {
                this.OnPropertyValueChange(_.PinYinCode, _PinYinCode, value);
                this._PinYinCode = value;
            }
        }

        public String CodeTableID
        {
            get
            {
                return this._CodeTableID;
            }
            set
            {
                this.OnPropertyValueChange(_.CodeTableID, _CodeTableID, value);
                this._CodeTableID = value;
            }
        }

        public String ClassCode
        {
            get
            {
                return this._ClassCode;
            }
            set
            {
                this.OnPropertyValueChange(_.ClassCode, _ClassCode, value);
                this._ClassCode = value;
            }
        }

        public Guid? ParentOID
        {
            get
            {
                return this._ParentOID;
            }
            set
            {
                this.OnPropertyValueChange(_.ParentOID, _ParentOID, value);
                this._ParentOID = value;
            }
        }

        public Guid? CodeClassifyOID
        {
            get
            {
                return this._CodeClassifyOID;
            }
            set
            {
                this.OnPropertyValueChange(_.CodeClassifyOID, _CodeClassifyOID, value);
                this._CodeClassifyOID = value;
            }
        }

        /// <summary>
        /// 获取实体对应的表名
        /// </summary>
        protected override Table GetTable()
        {
            return new Table<CodeValue>("CodeValue");
        }

        /// <summary>
        /// 获取列信息
        /// </summary>
        protected override Field[] GetFields()
        {
            return new Field[] {
                        _.CodeValueOID,
                        _.CodeID,
                        _.CodeName,
                        _.ParentCodeID,
                        _.PinYinCode,
                        _.CodeTableID,
                        _.ClassCode,
                        _.ParentOID,
                        _.CodeClassifyOID};
        }

        /// <summary>
        /// 获取列数据
        /// </summary>
        protected override object[] GetValues()
        {
            return new object[] {
                        this._CodeValueOID,
                        this._CodeID,
                        this._CodeName,
                        this._ParentCodeID,
                        this._PinYinCode,
                        this._CodeTableID,
                        this._ClassCode,
                        this._ParentOID,
                        this._CodeClassifyOID};
        }

        /// <summary>
        /// 给当前实体赋值
        /// </summary>
        protected override void SetValues(IRowReader reader)
        {
            if ((false == reader.IsDBNull(_.CodeValueOID)))
            {
                this._CodeValueOID = reader.GetGuid(_.CodeValueOID);
            }
            if ((false == reader.IsDBNull(_.CodeID)))
            {
                this._CodeID = reader.GetString(_.CodeID);
            }
            if ((false == reader.IsDBNull(_.CodeName)))
            {
                this._CodeName = reader.GetString(_.CodeName);
            }
            if ((false == reader.IsDBNull(_.ParentCodeID)))
            {
                this._ParentCodeID = reader.GetString(_.ParentCodeID);
            }
            if ((false == reader.IsDBNull(_.PinYinCode)))
            {
                this._PinYinCode = reader.GetString(_.PinYinCode);
            }
            if ((false == reader.IsDBNull(_.CodeTableID)))
            {
                this._CodeTableID = reader.GetString(_.CodeTableID);
            }
            if ((false == reader.IsDBNull(_.ClassCode)))
            {
                this._ClassCode = reader.GetString(_.ClassCode);
            }
            if ((false == reader.IsDBNull(_.ParentOID)))
            {
                this._ParentOID = reader.GetGuid(_.ParentOID);
            }
            if ((false == reader.IsDBNull(_.CodeClassifyOID)))
            {
                this._CodeClassifyOID = reader.GetGuid(_.CodeClassifyOID);
            }
        }

        public override int GetHashCode()
        {
            return base.GetHashCode();
        }

        public override bool Equals(object obj)
        {
            if ((obj == null))
            {
                return false;
            }
            if ((false == typeof(CodeValue).IsAssignableFrom(obj.GetType())))
            {
                return false;
            }
            if ((((object)(this)) == ((object)(obj))))
            {
                return true;
            }
            return false;
        }

        public class _
        {

            /// <summary>
            /// 表示选择所有列，与*等同
            /// </summary>
            public static AllField All = new AllField<CodeValue>();

            /// <summary>
            /// 字段名：CodeValueOID - 数据类型：Guid
            /// </summary>
            public static Field CodeValueOID = new Field<CodeValue>("CodeValueOID");

            /// <summary>
            /// 字段名：CodeID - 数据类型：String
            /// </summary>
            public static Field CodeID = new Field<CodeValue>("CodeID");

            /// <summary>
            /// 字段名：CodeName - 数据类型：String
            /// </summary>
            public static Field CodeName = new Field<CodeValue>("CodeName");

            /// <summary>
            /// 字段名：ParentCodeID - 数据类型：String
            /// </summary>
            public static Field ParentCodeID = new Field<CodeValue>("ParentCodeID");

            /// <summary>
            /// 字段名：PinYinCode - 数据类型：String
            /// </summary>
            public static Field PinYinCode = new Field<CodeValue>("PinYinCode");

            /// <summary>
            /// 字段名：CodeTableID - 数据类型：String
            /// </summary>
            public static Field CodeTableID = new Field<CodeValue>("CodeTableID");

            /// <summary>
            /// 字段名：ClassCode - 数据类型：String
            /// </summary>
            public static Field ClassCode = new Field<CodeValue>("ClassCode");

            /// <summary>
            /// 字段名：ParentOID - 数据类型：Nullable`1
            /// </summary>
            public static Field ParentOID = new Field<CodeValue>("ParentOID");

            /// <summary>
            /// 字段名：CodeClassifyOID - 数据类型：Nullable`1
            /// </summary>
            public static Field CodeClassifyOID = new Field<CodeValue>("CodeClassifyOID");
        }
    }
}
